package com.atwy.utils;

import java.awt.*;
import java.util.ArrayList;

/**
 * @Author: 30467
 * @Date: 2020/5/18
 */
public class Test {

    public static final String PATH = "D:\\BB\\";

    public static void main(String[] args) {

        test3();
    }


    public static void test6(){
        IOUtils.doScaleImages(PATH+"zp=.png","260*350",true);
    }

    public static void test5(){
        ArrayList<Imageftl> ryCardimgList = getRyCardimgList(PATH);
        String targetImg = PATH + "cardTemplate.jpg";

        IOUtils.pressImage(targetImg, ryCardimgList, PATH + "rycard.jpg");

        System.out.println("ok");

    }

    /**
     * 绘制带文字的图片
     */
    public static void test4() {
        Color color = new Color(0, 0, 0);
        Font font = new Font("微软雅黑", Font.BOLD, 73);
        IOUtils.creatWordsImg("王琰", PATH, 1, Color.black, 9, font);

        font = new Font("微软雅黑", Font.PLAIN, 44);
        IOUtils.creatWordsImg("071240133", PATH, 2, color, 9, font);

        IOUtils.creatWordsImg("南京航空航天大学", PATH, 3, color, 9, font);

        System.out.println("ok");
    }

    //二维码
    public static void test3() {
        byte[] ewm = IOUtils.getEwm("2020520 晓慧", 7);
        System.out.println(ewm);
        IOUtils.saveZp(ewm, "D:\\BB\\ewm.png");
        System.out.println("ok");
    }

    //读取图片，生成图片
    public static void test2() {
        byte[] imageBinary = IOUtils.getImageBinary("D:\\AA\\github.jpg");
        System.out.println(imageBinary);

        IOUtils.saveZp(imageBinary, "D:\\BB\\123.png");
        System.out.println("ok");
    }

    public static void test() {
        String savePath = IOUtils.getSavePath("12345670");
        System.out.println(savePath);
    }


    public static ArrayList<Imageftl> getRyCardimgList(String wordspath) {
        ArrayList<Imageftl> list = new ArrayList<Imageftl>();

        //个人姓名
        Imageftl imgf = new Imageftl();
        imgf.setUrl(wordspath + "words1.png");
        imgf.setPrjx(303);
        imgf.setPrjy(659);
        list.add(imgf);

        //编号
        Imageftl imgf2 = new Imageftl();
        imgf2.setUrl(wordspath + "words2.png");
        imgf2.setPrjx(349);
        imgf2.setPrjy(797);
        list.add(imgf2);


        //所属门店
        Imageftl imgf3 = new Imageftl();
        imgf3.setUrl(wordspath + "words3.png");
        imgf3.setPrjx(349);
        imgf3.setPrjy(872);
        list.add(imgf3);

        //人员头像
        Imageftl imgf4 = new Imageftl();
        imgf4.setUrl(wordspath + "wy.jpg");
        imgf4.setPrjx(303);
        imgf4.setPrjy(500);
        list.add(imgf4);


        //二维码
        Imageftl imgf5 = new Imageftl();
        imgf5.setUrl(wordspath + "ewm.png");
        imgf5.setPrjx(635);
        imgf5.setPrjy(1085);
        list.add(imgf5);


        //企业logo
        Imageftl imgf6 = new Imageftl();
        imgf6.setUrl(wordspath + "qy.jpg");
        imgf6.setPrjx(220);
        imgf6.setPrjy(50);
        list.add(imgf6);

        return list;
    }
}

